package com.fitness.fitness.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fitness.fitness.modal.user.entity.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RoleMapper extends BaseMapper<Role> {

    @Select("select r.* from t_role_user ru,t_role r where r.id = ru.role_id and user_id = #{userId}")
    List<Role> getRoleList(@Param("userId") Long userId);

    @Select("select r.* from t_role_user ru,t_role r where r.id = ru.role_id and user_id = #{userId}")
    Role getRoleByUid(@Param("userId") Long userId);
}
